﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TFSRestApiHelper
{
    public class WorkItemAtrr
    {
        [JsonProperty("id")]
        public int id;
        [JsonProperty("rev")]
        public int rev;
        [JsonProperty("fields")]        
        public Dictionary<string, object> fields;
        [JsonProperty("relations")]
        public List<WorkItemRelation> relations;
        [JsonProperty("_links")]
        public WorkItemLinks _links;
        [JsonProperty("url")]
        public string url;

        public class WorkItemRelation
        {
            [JsonProperty("rel")]
            public string rel;
            [JsonProperty("url")]
            public string url;
            [JsonProperty("attributes")]
            public WorkItemRelationAtrr attributes;
        }

        public class WorkItemRelationAtrr
        {
            [JsonProperty("isLocked")]
            public bool isLocked;
            [JsonProperty("comment")]
            public string comnment;
        }

        public class WorkItemLinks
        {
            [JsonProperty("self")]
            public WorkItemLink self;
            [JsonProperty("workItemUpdates")]
            public WorkItemLink workItemUpdates;
            [JsonProperty("workItemRevisions")]
            public WorkItemLink workItemRevisions;
            [JsonProperty("workItemHistory")]
            public WorkItemLink workItemHistory;
            [JsonProperty("html")]
            public WorkItemLink html;
            [JsonProperty("workItemType")]
            public WorkItemLink workItemType;
            [JsonProperty("fields")]
            public WorkItemLink fields;
        }

        public class WorkItemLink
        {
            [JsonProperty("href")]
            public string href;
        }
    }    
}
